<template>
	<view class="page">
		<!-- <CustomNav :isBack="true" title="到站车次"></CustomNav> -->
		<view class="list-block">
			<view class="list-item" v-for="item in list" :key="item.id" @click="navigate('/pages/train/detail?id='+item.id)">
				<view class="title">{{item.title}}</view>
				<view class="time">{{item.createTime}}</view>
			</view>
		</view>
		<view v-if="list.length === 0" class="empty">暂无数据</view>
	</view>
</template>

<script>
	import { getTrainListApi } from '@/api/train.js'
	export default {
		data() {
			return {
				list: []
			}
		},
		methods: {
			getList() {
				getTrainListApi().then(res => {
                 
					this.list = res
				})
			}
		},
		onLoad() {
			this.getList()
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		background-color: #F7F6F9;
		min-height: 100vh;
		.list-block {
			padding: 30rpx;
			.list-item {
				background-color: #fff;
				padding: 30rpx;
				border-radius: 20rpx;
				margin-bottom: 20rpx;
				.title {
					font-size: 32rpx;
					font-weight: bold;
					margin-bottom: 20rpx;
				}
				.time {
					font-size: 26rpx;
					color: #999;
				}
			}
		}
		.empty {
			text-align: center;
			padding: 30rpx;
			color: #999;
		}
	}
</style> 